1. Field of the Invention
The present invention relates to a method and system of data encoding, and more particularly to a method and system for encoding digital data for an optical recording system.
2. Description of the Prior Art
While an optical recording system writes data onto an optical recording medium, the optical recording system needs to proceed a series of encoding process at first so that the data can be written onto the optical recording medium by the optical recording system. Here is an example for the conventional digital versatile disc (DVD). Please refer to FIG. 1. FIG. 1 is a flow chart of the main steps of the DVD data encoding process according to the prior art. Briefly, the conventional DVD data encoding process comprises the following steps:
Step S110: buffering the storage data or so-called the main data into the memory to form a data sector;
Step S112: scrambling the main data to form a scrambled data sector;
Step S114: encoding and buffering the 16 scrambled data sectors into the memory to form an error correcting code block (ECC block);
Step S116: dividing an ECC block into 16 recording sectors;
Step S118: modulating each recording sector by way of eight to fourteen modulation plus to form a physical sector recorded on the DVD.
The followings are illustrations and descriptions for each step shown in FIG. 1. Please refer to FIG. 2. FIG. 2 is a schematic diagram of the data sector 10 according to the prior art. Before written into the DVD, the main data must be buffered into the memory within the DVD recording system, and the format of the main data within the memory is called data sector. The conventional data sector 10 is used for storing an identification data (ID) 12, an identification error detection code (IED) 14, a copyright management information (CPRMAI) 16, a main data 18, and an error detection code 22 corresponding to the above data. The corresponding locations of the above data arranged within the memory are shown as FIG. 2.
The identification data 12 has four bytes, wherein the first byte comprises the message of the data sector 10, and the other three bytes represent the number of the data sector 10. The identification error detection code 14 has two bytes for detecting the error of the identification data 12. The copyright management information 16 has six bytes as a basis of using the copyright of the data sector 10. After adding up the main data for 2048 bytes and the error detection code 22 for 4 bytes, a data sector 10 has data for 2064 bytes. A data sector which is divided into a 12×172 matrix (12 rows and 172 columns) is arranged in the memory in the prior art.
The steps of buffering the data into the data sector 10 comprise calculating the error detection code in accordance with the identification data 12 to get the identification error detection code 14. After getting the identification error detection code 14, buffer the identification data 12, the identification error detection code 14, the copyright management information. 16, and the main data 18 into the corresponding location in the memory as shown in FIG. 2. Then the DVD recording system reads the above data recorded in the memory to calculate the error detection code 22 of the above data. Finally buffer the identification data 12, the identification error detection code 14, the copyright management information 16, and the main data 18 with the error detection code 22 into the memory. Up to this step, the temporary storage of a data sector and the calculating process of the error detection code have been completed.
Please refer to FIG. 3. FIG. 3 is a schematic diagram of the scrambled data sector SSi in the prior art. After completing the data sector shown in FIG. 2, DVD reads the main data 18 again from the memory and scrambles the main data to form a scrambled data 24. Then buffer the scrambled data 24 for 2048 bytes into the memory to form a scrambled data sector SSi. Because the scrambled data 24 and the main data 18 are both 2048 bytes, the data arrangement and storage for the scrambled data sector SSi is the same as that for the data sector 10.
Please refer to FIG. 4. FIG. 4 is a schematic diagram of the ECC block 20 in the prior art. The process from the main data to the scrambled data sector should be proceeded for 16 times. After finishing the 16 scrambled data sectors SSi (i=0˜15), the DVD recording system begins to form an ECC block 20. According to the data arrangement for the scrambled data sector SSi, the 16 scrambled data sectors SSi should be a 192×172 matrix (192 rows and 172 columns). Then DVD reads the data of 16 scrambled data sectors to calculate an outer parity code 26 and an inner parity code 28.
The calculation for the outer parity code (PO) 26 is to calculate the data of a column within the 16 scrambled data sectors to get an outer parity code for 16 bytes corresponding to the column. After calculating the data of all 172 columns within the 16 scrambled data sectors, the calculating is completed and a whole set of outer parity codes 26 is obtained. Then buffer the outer parity codes 26 behind the last row of the 16 scrambled data sectors. Accordingly, the data arrangement for the outer parity code 26 is a 16×172 matrix (16 rows and 172 columns).
The calculation of the inner parity code (PI) 28 is to calculate the data of the 16 scrambled data sectors and each row within the whole set of outer parity codes 26 gets an inner parity code for 10 bytes corresponding to the row. After calculating the data of all 208 rows, a whole set of inner parity codes 28 is obtained. Accordingly, the data arrangement for the inner parity code 28 is a 208×10 matrix (208 rows and 10 columns).
Please refer to FIG. 5. FIG. 5 is a schematic diagram of the 16 recording sectors RSi in the prior art. After code calculation for the outer parity code 26 and the inner parity code 28, divide the whole set of outer parity codes 26 into 16 rows of the outer parity code POi (i=0˜15) and interleave each of the rows into each of the 16 scrambled data sectors SSi (i=0˜15) respectively and correspondingly. The interleaved address is the next row of the last data row within each of the scrambled data sectors to further form a data arrangement of 13 rows. At this time, the sector is called the recording sector RSi (i=0˜15).
As shown in FIG. 1, after the above steps, the last step of the DVD data encoding processes is to read the 16 recording sectors RSi (i=0˜15) one by one from the memory and further to proceed the eight to fourteen modulation plus (EFM plus) of the data. Therefore, the DVD recording system can record the data stored in the recording sector as a physical sector within the DVD.
Please refer to FIG. 6. FIG. 6 is a flow chart of a complete DVD data encoding process according to the prior art. According to the above explanation, the conventional DVD encoding method is structurally conscientious, but involves too many processes. The whole data encoding process is summarized and comprises the following steps:
Step S220: calculating the error detection code of the identification data 12 to form the identification error detection code 14.
Step S222: buffering the identification data 12, the identification error detection code 14, the copyright management information 16, and the main data 18 into the memory.
Step S224: reading the identification data 12, the identification error detection code 14, the copyright management information 16, and the main data 18 recorded in the memory to calculate the error detection code 22 of the above data.
Step S226: buffering the identification data 12, the identification error detection code 14, the copyright management information 16, the main data 18, and the error detection code 22 into the memory to finish temporary storage for a data sector and the calculating process of the error detection code.
Step S228: reading the main data 18 from the memory and scrambling the main data 18 to form a scrambled data 24.
Step S230: buffering the scrambled data 24 for 2048 bytes into the memory to form a scrambled data sector SSi.
Step S232: proceeding the above processes (from steps S220 to S230) repeatedly to form 16 scrambled data sectors SSi (i=0˜15) After forming 16 scrambled data sectors, go to step 34.
Step S234: reading the data of the 16 scrambled data sectors to proceed calculating of the outer parity code 26 and the inner parity code 28.
Step S236: dividing the whole set of outer parity codes 26 into 16 rows of the outer parity code POi (i=0˜15), and interleaving the rows into the 16 scrambled data sectors SSi (i=0˜15) respectively and correspondingly.
Step S238: reading the 16 recording sectors RSi (i=0˜15) one by one from the memory to proceed the eight to fourteen modulation plus (EFM plus) of the data.
Such complicated steps in the prior art cause a DVD recording system to access memory for many times and increase the requirement for the memory bandwidth. Furthermore, the above step S226 and step S228 are just brief descriptions, and the steps require multiple memory accesses. Hence, it is necessary to provide an improved method to reduce such multiple memory accesses to lower the requirement for the memory bandwidth for the DVD.